#include "Player.h"
#include <iostream>
#include "InputHandler.h"
#include "Defines.h"

Player::Player()
{
}

void Player::LoadPlayerData()
{
	mResources.Wood = mResources.Gold = mResources.Stone = 100;
}

bool Player::Purchase(Resources costs)
{
	if (costs.Wood <= mResources.Wood)
		mResources.Wood -= costs.Wood;
	else
		return false;
	if (costs.Stone <= mResources.Stone)
		mResources.Stone -= costs.Stone;
	else
		return false;
	if (costs.Gold <= mResources.Gold)
		mResources.Gold -= costs.Gold;
	else
		return false;

	return true;
}

bool Player::PurchaseUpgrade(int wood, int stone, int gold)
{
	if (wood <= mResources.Wood)
		mResources.Wood -= wood;
	else
		return false;
	if (stone <= mResources.Stone)
		mResources.Stone -= stone;
	else
		return false;
	if (gold <= mResources.Gold)
		mResources.Gold -= gold;
	else
		return false;

	return true;
}

void Player::addResources(int wood, int stone, int gold)
{
	mResources.Wood += wood;
	mResources.Stone += stone;
	mResources.Gold += gold;
}
